package com.winning.gjhlht.ihe.hl7ClientService.iheResponse;

import java.util.Map;

import org.apache.log4j.Logger;

import com.winning.common.Constans;
import com.winning.common.data.service.PlatBasicDataService;
import com.winning.core.base.IHEResponseServiceInter;

/**
 * 类名称：AuditMessageServiceResponse
 * 类描述：   共享文档审计结果上传
 * 创建人：zq
 * 创建时间：2017-1-24 上午9:22:21
 * 修改人：zq
 * 修改时间：2017-1-24 上午9:22:21
 * 修改备注：
 */
public class AuditMessageServiceResponse implements IHEResponseServiceInter {

    private static Logger LOGGER = Logger.getLogger(Constans.LOG4J_PBS_LOGGER_ID);

    @Override
    public Map<String, Object> resonseHandler(PlatBasicDataService platBasicDataService, String responseXMLMessage, Map<String, Object> requestInfoMap, String dataSourseID) {

        LOGGER.info("-->进入审计结果返回处理");

        LOGGER.info("-->一条审计消息:" + requestInfoMap.toString());


        //共享文档唯一编号
        String UniqueId = "";

        if (requestInfoMap.containsKey("UNIQUEID")) {
            UniqueId = requestInfoMap.get("UNIQUEID").toString();
        }

        if (UniqueId != null || !UniqueId.equals("")) {

            int result = platBasicDataService.saveAuditMessage(UniqueId, dataSourseID);

            if (result == 1) {
                LOGGER.info("-->共享文档审计结果保存成功");
            } else {
                LOGGER.info("-->共享文档审计结果保存失败");
            }
        }

        return null;
    }

}
